package com.xbongbong.saas.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.pojo.FieldAttrEntityForImport;
import com.xbongbong.paas.pojo.dto.FormDataListDTO;
import com.xbongbong.paas.pojo.dto.SaasFormSaveDTO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.product.pojo.dto.ProductSerialDTO;
import com.xbongbong.pro.product.pojo.dto.ProductSerialFieldDTO;
import com.xbongbong.pro.product.pojo.dto.ProductSerialFlowDTO;
import com.xbongbong.pro.product.pojo.vo.ProductSerialFlowVO;
import com.xbongbong.pro.product.pojo.vo.ProductSerialVO;
import com.xbongbong.saas.domain.entity.ProductSerialFlowEntity;

import java.util.List;

/**
 * 序列号
 *
 * @author jiantao.xiong
 * @date 2020/5/21
 */
public interface ProductSerialService extends AccordConfigAddMenuHandle {
    /**
     * 序列号出入库表保存
     *
     * @param saasFormSaveDTO 参数
     * @param productStr
     * @throws XbbException 异常
     */
    void saveSerial(SaasFormSaveDTO saasFormSaveDTO, String productStr) throws XbbException;

    /**
     * 批量更新序列号
     *
     * @param corpid       公司id
     * @param refIdIn      入库单id
     * @param businessType 业务类型
     * @throws XbbException 异常
     */
    void deleteSerial(String corpid, List<Long> refIdIn, Integer businessType) throws XbbException;

    /**
     * 录入序列号弹窗数据
     *
     * @param productSerialDTO 入参
     * @return ProductSerialVO
     */
    ProductSerialVO getSerialFields(ProductSerialFieldDTO productSerialFieldDTO) throws XbbException;

    /**
     * 获取需选择的序列号
     *
     * @param productSerialDTO
     * @return
     */
    ProductSerialVO getSerial(ProductSerialDTO productSerialDTO) throws XbbException;


    /**
     * 编辑和详情页的序列号回显
     *
     * @param productSerialDTO 产品序列号DTO
     * @return
     * @throws XbbException
     */
    ProductSerialVO selectSerial(ProductSerialDTO productSerialDTO) throws XbbException;

    /**
     * 序列号跟踪
     *
     * @param productSerialFlowDTO 入参
     * @return 序列号流水
     * @throws XbbException 异常
     */
    ProductSerialFlowVO getSerialFlow(ProductSerialFlowDTO productSerialFlowDTO) throws XbbException;


    List<ProductSerialFlowEntity> getProductSerial(Long refId, Integer businessType, String corpid) throws XbbException;

    ProductSerialVO checkSerialStatus(ProductSerialDTO productSerialDTO) throws XbbException;

    void formatExportValue(List<PaasFormDataEntityExt> paasFormDataESList, FormDataListDTO formDataListDTO, List<FieldAttrEntityForImport> fieldAttrList) throws XbbException;

    void preCheckDelSerial(List<Long> refIdIn, String corpid, Integer businessType) throws XbbException;

    void preCheckSaveSerial(JSONObject formData, JSONArray productArray, String productAttr, Integer businessType, String corpid) throws XbbException;

    void dataConsistencyUpdateSeqSearch(String corpid, Long dataId, Integer visible) throws XbbException;

    void delProductSerial(String corpid, Long refProductId, Integer businessType) throws XbbException;
}
